﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Register.Command;
using Register.DBUtility;
using Register.IDAL;
using Register.Model;
using System.Data.SqlClient;
using System.Data;
namespace Register.DAL
{
    /// <summary> 
    /// FileName: CheckLogin.cs    
    /// CLRVersion: 4.0.30319.269    
    /// Author: DoubleZ    
    /// Corporation:     
    /// Description:     
    /// DateTime: 2012/7/17 16:53:47    
    /// </summary>
    public class CheckLoginDAL : ICheckLoginDAL
    {
        #region 检查是否为管理员用户
        public   bool ExistsAdmin(string name, string pwd) {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from System_adminInfo");
            strSql.Append(" where Administrator_Name=@Administrator_Name and Administrator_Password=@Administrator_Password ");
            SqlParameter[] parameters = {
					new SqlParameter("@Administrator_Name", SqlDbType.VarChar,20),
                    new SqlParameter("@Administrator_Password", SqlDbType.Char,32)
                                        
                                        };
            parameters[0].Value = name;
            parameters[1].Value = pwd;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }
        #endregion
      #region 检查是否为医生用户
    public    bool ExistsDoctor(string name, string pwd) {
        StringBuilder strSql = new StringBuilder();
        strSql.Append("select count(1) from System_doctorUserInfo");
        strSql.Append(" where DoctorUser_UserName=@DoctorUser_UserName and DoctorUser_Password=@DoctorUser_Password ");
        SqlParameter[] parameters = {
					new SqlParameter("@DoctorUser_UserName", SqlDbType.VarChar,20),
                    new SqlParameter("@DoctorUser_Password", SqlDbType.Char,32)
                                        
                                        };
        parameters[0].Value = name;
        parameters[1].Value = pwd;

        return DbHelperSQL.Exists(strSql.ToString(), parameters);
    }
      #endregion
    }
}
